// https://www.acwing.com/problem/content/803/

#include <iostream>
#include <vector>

using namespace std;


int main() {
    int n;
    cin>>n;

    auto calc = [&](int tmp) {
        int count = 0;
        while (tmp > 0) {
            if (tmp & 1)  {
                count+=1;
            }
            tmp >>= 1;
        }
        return count;
    };

    for (int i=0; i<n; i++) {
        int tmp;
        cin>>tmp;
        cout<<calc(tmp)<<" ";
    }
    return 0;
}
